Next | Prev | Up | Top | Contents | Index

Making an XFS Filesystem

This section explains how to create an XFS filesystem on an empty disk partition or XLV logical volume. (For information about creating XLV logical volumes, see Chapter 7, "Creating and Administering XLV Logical Volumes.")

Tip: You can make an XFS filesystem on a disk partition or a logical volume using the graphical user interface of the xfsm command. For information, see its online help.

Caution: When you create a filesystem, all files already on the disk partition or logical volume are destroyed.

  1. Review the subsections within the section "Planning for XFS Filesystems" in this chapter to verify that you are ready to begin this procedure.

  2. Identify the device name of the partition or logical volume where you plan to create the filesystem. This is the value of partition in the examples below. For example, if you plan to use partition 7 (the entire disk) of a SCSI option disk on controller 0 and drive address 2, partition is /dev/dsk/dks0d2s7. For more information on determining partition, see Table 1-4, the section "Introduction to Logical Volumes" in Chapter 6, and the dks(7M) reference page.

  3. If the disk partition is already mounted, unmount it:

    # umount partition

    Any data that is on the disk partition is destroyed (to convert the data rather than destroy it, use the procedure in the section "Converting a Filesystem on an Option Disk From EFS to XFS" in this chapter instead).

  4. If you are making a filesystem on a disk partition or on an XLV logical volume that doesn't have a log subvolume, use this mkfs command to create the new XFS filesystem:

    # mkfs -b size=blocksize -l size=logsize partition

    blocksize is the filesystem block size (see the section "Choosing the Filesystem Block Size and Extent Size" in this chapter) and logsize is the size of the area dedicated to log records (see the section "Choosing the Log Type and Size" in this chapter). The default values are 4 KB blocks and a 1000 block log.

    Example 4-1 shows the command line used to create an XFS filesystem and the system output. The filesystem has a 10 MB internal log and a block size of 1K bytes and is on the partition /dev/dsk/dks0d2s7.

Example 4-1 : mkfs Command for an XFS Filesystem With an Internal Log

# mkfs -b size=1k -l size=10m /dev/dsk/dks0d2s7 
meta-data=/dev/dsk/dks0d2s7      isize=256    agcount=8, agsize=128615 blks
data     =                       bsize=1024   blocks=1028916
log      =internal log           bsize=1024   blocks=10240
realtime =none                   bsize=65536  blocks=0, rtextents=0

  1. If you are making a filesystem on an XLV logical volume that has a log subvolume (for an external log), use this mkfs command to make the new XFS filesystem:

    # mkfs -b size=blocksize volume

    blocksize is the block size for filesystem (see the section "Choosing the Filesystem Block Size and Extent Size" in this chapter), and volume is the device name for the volume.

    Example 4-2 shows the command line used to create an XFS filesystem on a logical volume /dev/dsk/xlv/a with a block size of 1K bytes and the system output.

    Example 4-2 : mkfs Command for an XFS Filesystem With an External Log

# mkfs -b size=1k /dev/dsk/xlv/a 
meta-data=/dev/dsk/xlv/a         isize=256    agcount=8, agsize=245530 blks
data     =                       bsize=1024   blocks=1964240
log      =volume log             bsize=1024   blocks=25326
realtime =none                   bsize=65536  blocks=0, rtextents=0

Example 4-3 shows the command line used to create an XFS filesystem on a logical volume /dev/dsk/xlv/xlv_data1 that includes a log, data, and real-time subvolumes and the system output. The default block size of 4096 bytes is used and the real-time extent size is set to 128K bytes.

Example 4-3 : mkfs Command for an XFS Filesystem With a Real-Time Subvolume

# mkfs_xfs -r extsize=128k /dev/rdsk/xlv/xlv_data1 
meta-data=/dev/rdsk/xlv/xlv_data1 isize=256    agcount=8, agsize=4300 blks
data     =                       bsize=4096   blocks=34400
log      =volume log             bsize=4096   blocks=34400
realtime =volume rt              bsize=131072 blocks=2560, rtextents=80

  1. To use the filesystem, you must mount it. For example:

    # mkdir mountdir

    # mount partition mountdir

    For more information about mounting filesystems, see the section "Manually Mounting Filesystems" in Chapter 5.

  2. To configure the system so that the new filesystem is automatically mounted when the system is booted, add this line to the file /etc/fstab:

    partition mountdir xfs rw,raw=rawpartition 0 0

    where rawpartition is the raw version of partition. For example, if partition is /dev/dsk/dks0d2s7, rawpartition is /dev/rdsk/dks0d2s7.

    For more information about automatically mounting filesystems, see the section "Mounting Filesystems Automatically With the /etc/fstab File" in Chapter 5.



Next | Prev | Up | Top | Contents | Index